﻿using ReservaVueloBO.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Security;
using ReservaVueloBO.SeguridadService;

namespace ReservaVueloBO.Controllers
{
    public class LoginController : Controller

    {
    [HttpGet]
        public ActionResult LogOn()
        { 
         
            return View();
        }

        [HttpPost]
        public ActionResult LogOn(ReservaVueloBO.Models.Usuario model)
        {
            SeguridadServiceClient objcliente = new SeguridadServiceClient();

            ReservaVueloBO.SeguridadService.Usuario objusuario = objcliente.ValidarUsuario(model.User, model.Password);

            if (objusuario == null)
            {
                return View("/Views/Home/Index.cshtml");
            }
            else
                Session["USUARIO"] = model.User;
                return View("/Views/Home/buscar_reserva.cshtml");
        }
        

    }
}